package com.asp.aspchain.admin.rest;

import com.alibaba.fastjson.JSON;
import com.asp.aspchain.admin.biz.AppBaseBiz;
import com.asp.aspchain.admin.biz.SequenceBiz;
import com.asp.aspchain.admin.entity.AppBase;
import com.asp.aspchain.common.msg.ObjectRestResponse;
import com.asp.aspchain.common.rest.BaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


/**
 * 控制器
 *
 * @author asp
 * @Date 2018-12-17 19:08
 */
@RestController
@RequestMapping("/app")
public class AppBaseController extends BaseController<AppBaseBiz, AppBase> {

	private static final Logger logger = LoggerFactory.getLogger(AppBaseController.class);

	@Autowired
	private AppBaseBiz appBaseBiz;
	@Autowired
	private SequenceBiz sequenceBiz;


	@PostMapping("/add")
	public ObjectRestResponse add(@RequestBody String json) throws Exception {
		AppBase appBase = JSON.parseObject(json, AppBase.class);
		appBase.setCreatetime(new Date());
		appBase.setUpdatetime(appBase.getCreatetime());
		appBaseBiz.insert(appBase);
		ObjectRestResponse response = new ObjectRestResponse();
		response.setRel(true);
		return response;
	}


}